//
// Created by Administrator on 2024/4/22.
//

#include <iostream>
#include "linkedListUtil.h"
using namespace std;

Node * reverse(Node *h)
{
    Node *cur=nullptr;
    h = h->next;
    Node *pre =nullptr;
    while(h)
    {
        cur = h->next;
        h->next = pre;
        pre=h;
        h=cur;
    }
    h= new Node{-1,pre};
    return h;
}
int main()
{
    vector<int> l{0,1,2,3,4,5};
    Node *head = build(l);
    printLinkedList(head);
    head = reverse(head);
    printLinkedList(head);
    return 0;
}